<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="/${initParam.context_root}/js/jquery.min.js"></script>
<script type="text/javascript" src="/${initParam.context_root}/js/bootstrap.js"></script>
<script type="text/javascript" src="/${initParam.context_root}/js/noty/jquery.noty.js"></script>
<script type="text/javascript" src="/${initParam.context_root}/js/noty/default.js"></script>
<script type="text/javascript" src="/${initParam.context_root}/js/noty/topCenter.js"></script>
<script type="text/javascript" src="/${initParam.context_root}/js/comment.js"></script>
<link rel="stylesheet" href="/${initParam.context_root}/css/bootstrap.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>내부프레임입니다.</title>
<script type="text/javascript">
$(function(){
	$("iframe", parent.document).height($(document).height());
	comment();
	$('.modifyComm, .deleteComm').tooltip('hide');
});
</script>
</head>
<body style="height: 100%;">
	<strong id="totalNum">댓글 (${fn:length(commList)})</strong>
	<div id="wrap">
	<form id="commForm" action="/${initParam.context_root}/addComment.do" method="post">
		<table class="table table-hover">
			<c:if test="${not empty commList}">
				<c:choose >
				<c:when test="${fn:length(commList) == 0 }">
					<tr>
						<td colspan="3">등록된 댓글이 없습니다.</td>
					</tr>
				</c:when>
				<c:otherwise>
					<c:forEach var="comm" items="${commList}">
						<tr>
							<td><c:out value="${comm.regName}" /></td>
							<td class="comm" style="padding: 10px;"><span class="origin"><c:out value="${comm.content}" /></span></td>
							<td>
								<ul class="inline" style="text-align: right;">
									<li style="display: none;">${comm.cnum}</li>
									<li><c:out value="${comm.regDate}" /></li>
									<li><a class="modifyComm" href="#" data-toggle="tooltip" data-title='수정'><i class="icon-pencil"></i></a></li>
									<li><a class="deleteComm" href="#" data-toggle="tooltip" data-title='삭제'><i class="icon-remove"></i></a></li>
								</ul>
							</td>
						</tr>
					</c:forEach>
				</c:otherwise>
				</c:choose>
			 </c:if> 
			<tr>
				<td width="100px"><h6>댓글쓰기</h6></td>
				<td><input type="hidden" name="bnum" value="${board.num}" /> 
				<input type="hidden" name="regName" value="${board.regName}" /> 
				<textarea id="content" name="content" rows="3" title="댓글내용" style="width:100%;"></textarea></td>
				<td width="200px"><p class="text-center" style="padding: 15px 0px 0px 0px;"><button id="insert" class="btn">등록</button></p></td>
			</tr>
		</table>
		</form>
	</div>
</body>
</html>